<div class="node-wrapper" (click)="clickOnNode(popup)" (dblclick)="$event.stopPropagation(); dblClickOnNode()"
    [ngSwitch]="node.type" suiPopup [popupTemplate]="popupNode" popupPlacement="right" popupTrigger="outsideClick"
    #popup="suiPopup">
    <app-workflow-wnode-pipeline *ngSwitchCase="'pipeline'" [project]="project" [workflow]="workflow" [node]="node"
        [noderun]="currentNodeRun" [warnings]="warnings"></app-workflow-wnode-pipeline>
    <app-workflow-wnode-join *ngSwitchCase="'join'" [project]="project" [workflow]="workflow" [node]="node"
        [noderun]="currentNodeRun" [workflowrun]="workflowRun"></app-workflow-wnode-join>
    <app-workflow-wnode-fork *ngSwitchCase="'fork'" [project]="project" [workflow]="workflow" [node]="node"
        [noderun]="currentNodeRun"></app-workflow-wnode-fork>
    <app-workflow-wnode-outgoing-hook *ngSwitchCase="'outgoinghook'" [project]="project" [workflow]="workflow"
        [node]="node" [noderun]="currentNodeRun" [workflowrun]="workflowRun"></app-workflow-wnode-outgoing-hook>
</div>
<ng-template let-popup #popupNode>
    <app-workflow-menu-wnode-edit (event)="receivedEvent($event)" [project]="project" [workflow]="workflow"
        [node]="node" [popup]="popup" [workflowrun]="workflowRun" [noderun]="currentNodeRun" [readonly]="readonly"
        #menu></app-workflow-menu-wnode-edit>
</ng-template>

<!-- MODALS -->
<ng-container *ngIf="project && node && workflow">

    <!-- Add trigger -->
    <app-workflow-trigger [loading]="loading" [project]="project" [workflow]="workflow" [source]="node"
        (triggerEvent)="updateWorkflow($event, workflowTrigger.modal)" #workflowTrigger></app-workflow-trigger>
    <!-- Add hook -->
    <app-hook-modal [loading]="loading" [project]="project" [workflow]="workflow" [node]="node"
        (hookEvent)="updateHook($event, workflowAddHook.modal)" #workflowAddHook></app-hook-modal>

    <!-- Delete Node -->
    <app-workflow-node-delete [loading]="loading" [node]="node" [workflow]="workflow"
        (deleteEvent)="updateWorkflow($event, workflowDeleteNode.modal)" #workflowDeleteNode></app-workflow-node-delete>

    <ng-container *ngIf="project && node && workflowRun">
        <app-workflow-node-run-param [workflow]="workflow" [project]="project" [nodeRun]="currentNodeRun"
            [workflowRun]="workflowRun" [nodeToRun]="node" [num]="workflowRun.num" #workflowRunNode>
        </app-workflow-node-run-param>
    </ng-container>

</ng-container>
